module.service('ReturnGoodsOrder', ['$rootScope', function ($rootScope) {
    var service = {
        _baseUrl: "/azeroth/back/tran/",

        currentReturnGoodsOrder: {},
        returnGoodsOrderList: [],
        totalSceneCount: 0,
        
        queryList: function (disburseNo, returnGoodsNo, startDate, endDate, status, currentPage, pageSize, callback) {

            var paramData = {
                disburseNo: disburseNo,
                returnGoodsNo: returnGoodsNo,
            	status: status,
            	startDate: startDate,
            	endDate: endDate,
            	pageNum: currentPage,
                start: (currentPage - 1) * pageSize,
                pageSize: pageSize,
            };
            
            $rootScope.ajaxRequestPost(service._baseUrl + "getReturnGoodsOrderList.htm", paramData, function (resultJson) {
                angular.copy(resultJson.data, service.returnGoodsOrderList);
                service.totalSceneCount = resultJson.totalCount;
                
                if (callback) {
                    callback();
                }
            });

        },
        
        agreeReturnGoods: function (returnGoodsOrder, callback) {
            var paramData = {
            		returnGoodsNo: returnGoodsOrder.returnGoodsNo
            };
            
            $rootScope.ajaxRequestPost(service._baseUrl + "agreeReturnGoods.htm", paramData, function (resultJson) {
                if (callback) {
                    callback();
                }
                
            });
        }
        
    };
    return service;
}]);
